public class NewYear {
    public static void main(String[] args) {
        MobileShop shop = new MobileShop();
        shop.setMobileAmount(30);
        System.out.println("手机专卖店目前有"+shop.getMobileAmount()+"部手机");
        MobileShop.InnerPuchaseMoney inner = shop.new InnerPuchaseMoney(12000);
        inner.buyMovile();
        System.out.println("手机专卖店目前有"+shop.getMobileAmount()+"部手机");
    }
}

class MobileShop{
    private int mobileAmount;
    MobileShop(){

    }
    void setMobileAmount(int m){
        mobileAmount = m;
    }
    int getMobileAmount(){
        return mobileAmount;
    }
    class InnerPuchaseMoney{
        int moneyValue;
        InnerPuchaseMoney(int m){
            moneyValue = m;
        }
        void buyMovile(){
            if(moneyValue >= 20000){
                mobileAmount = mobileAmount - 6;
                System.out.println("用价值"+moneyValue+"的内部购物卷买了6部手机");
            }
            else if(moneyValue < 20000 && moneyValue >= 10000){
                mobileAmount = mobileAmount - 3;
                System.out.println("用价值" +moneyValue+ "的内部购物卷买了3部手机");
            }
        }
    }
}
